@extends('WShop::layout')

@section('content')
    @component('WShop::public.header')
        @slot('page_title'){{$page_title}} @endslot
    @endcomponent
    <div class="mui-content mui-scroll-wrapper" id="pullrefresh" style="background: transparent;">
        <div class=" mui-scroll" style="background-color: #f5f5f5;min-height: 100%;">
            <div class="mui-table-view mui-table-view-chevron mui-bottom">
                <div class="mui-queren-dingdan ">
                    <form id="wd" style="background: #fff0;" class="mui-input-group" action="{{url()->current()}}" method="post">
                        {{csrf_field()}}

                        <ul class="mui-table-view bg-fff">
                            <li class="mui-table-view-cell" style="margin-bottom: 0!important;">
                                <a class="mui-clearfix" href="javascript:;">
                                    <img src="{{asset(config('view.frontend.wap_login').'/images/wallet.png')}}" alt="" width="25" class="mui-pull-left" />
                                        <div class="mui-pull-left">
                                            <div>{{get_currency()['money2']}}：{{$wallet->money2}}</div>
                                            <div class="mui-text-red" style="font-size: 12px;">提现金额将汇入您注册时的账户里,请确保账户信息正确</div>
                                        </div>
                                </a>
                            </li>
                            <div class="input1">
                                <p style="background-color: #E8EFFE;text-align: center;font-size: 14px;padding: 5px;color: #dd524d; margin-bottom: 0;">最低提现金额{{get_rule('wd_min')}}最大{{get_rule('wd_max')}}且必须为{{get_rule('wd_mul')}}的整数倍@if(get_rule('wd_tax')> 0 && get_rule('wd_tax') <100)，手续费{{get_rule('wd_tax')}}%@endif,每天提现时间为{{json_decode(get_rule('wd_time'))}}</p>
                            </div>
                            <li style="background: #f2f2f2;height: 10px;"></li>
                            <li class="mui-table-view-cell">
                                <div class="flex">
                                    <label style="width: 100px;margin-left: 5px;">提现金额：</label>
                                    <input type="text" name="money" class="mui-input-clear" value="">
                                </div>
                            </li>
                            <li class="mui-table-view-cell">
                                <div class="flex flexs">
                                    <div style="width: 100px;margin-left: 5px;">备注：</div>
                                    <textarea name="remark" ></textarea>
                                </div>
                            </li>
                        </ul>
                        <div class="mui-title-header">收款方式</div>
                        <ul class="mui-table-view mui-table-view-radio bg-fff zhifu" style="margin-top: 0;">
                            <li class="mui-table-view-cell">
                                <a href="javascript:;" class="mui-navigate-right">
                                    <img src="{{asset(config('view.frontend.wap_login').'/images/alipay.png')}}" alt="" width="25" class="mui-pull-left" />
                                    <input type="radio" name="pay_type"  value="1" />支付宝
                                    <span style="float: right;color: red;margin-right: 30px;">{{$info->alipay}}</span>
                                </a>
                            </li>
                            <li class="mui-table-view-cell">
                                <a href="javascript:;" class="mui-navigate-right">
                                    <img src="{{asset(config('view.frontend.wap_login').'/images/weixin.png')}}" alt="" width="25" class="mui-pull-left" />
                                    <input type="radio" name="pay_type"  value="2"/>微信
                                    <span style="float: right;color: red;margin-right: 30px;">{{$info->weichat}}</span>
                                </a>
                            </li>
                            <li class="mui-table-view-cell mui-selected">
                                <a href="javascript:;" class="mui-navigate-right">
                                    <img src="{{asset(config('view.frontend.wap_login').'/images/yinhangka.png')}}" alt="" width="25" class="mui-pull-left" />
                                    <input type="radio" name="pay_type"  value="3" checked/>银行卡
                                    <span style="float: right;color: red;margin-right: 30px;">{{$info->bank_card}}</span>
                                </a>
                            </li>
                        </ul>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="mui-bar mui-bar-footer" style=" height: 50px;">
        <div class="flex">
            <div class="flex-item">
                <div class="mui-text-red">￥<b class="count mui-text-red" id="result">0</b></div>
            </div>
            <div class="flex-item mui-text-right" id="submit-btn">
                <button class="mui-btns"  style="margin:0 -10px 0 0;background: #5a92fd;width: 90%;height: 50px;line-height: 50px;border-radius: 2px;float: right;">提交申请</button>
            </div>
        </div>
    </div>
@endsection
@push('scripts')
    <script>

        $('input[name="money"]').bind('input propertychange', function() {
            $('#result').html($(this).val());
        });
            $('.mui-btns')[0].addEventListener('click',function(){
                // layer.open({
                //     type: 1
                //     ,content: '<h1>请输入支付密码</h1><input type="password" value="">'
                //     ,anim: 'up'
                //     ,style: 'position:fixed; bottom:0; left:0; width: 100%; height: 60%; padding:10px 0; border:none;'
                // });
                // return false;
            var form = $("#wd");
            $.ajax({
                type: 'post',
                url: $(form).attr('action'),
                dataType: 'json',
                data: $(form).serialize()
            }).done(function (response) {
                if(response.status){
                    mui.toast(response.msg);
                    setTimeout(function () {
                        location.href = response.url;
                    }, 2000);
                }else{
                    mui.toast(response.msg);
                }
            }).fail(function (XMLHttpRequest) {
                var errors = XMLHttpRequest.responseJSON.errors;
                if(typeof errors == 'object') {
                    for (var index in errors) { // 不推荐这样
                        mui.toast(errors[index][0]);
                        break;
                    }
                }else{
                    mui.toast(XMLHttpRequest.responseJSON.msg);

                }

            }).always(function () {

            });
        })
    </script>
@endpush